<?php

use think\facade\Route;

//解决跨域问题
header('Content-Type: *');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE');//设置允许访问的协议
header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies
header('Access-Control-Allow-Headers: *');

/**
 * 网站模块
 */
Route::group('website', function () {
    Route::get('getToken', 'webapi/WebsiteController/getToken');//获取token
    Route::post('setBaseDomain', 'webapi/WebsiteController/setBaseDomain');//设置网站基础域名
    Route::get('getChannelTreeList', 'webapi/WebsiteController/getChannelTreeList');//获取栏目列表(包含子集的树形列表)
    Route::get('getBaseInfo', 'webapi/WebsiteController/getBaseInfo');//获取网站信息
    Route::post('setAllInfo', 'webapi/WebsiteController/setAllInfo');//设置网站信息
    Route::post('setBaseInfo', 'webapi/WebsiteController/setBaseInfo');//设置网站基本信息
    Route::post('changeStatus', 'webapi/WebsiteController/changeStatus');//设置网站状态
    Route::post('bindCustomDomain', 'webapi/WebsiteController/bindCustomDomain');//绑定自定义域名
    Route::post('setRecordNumber', 'webapi/WebsiteController/setRecordNumber');//设置备案号
    Route::get('getDomainInfo', 'webapi/WebsiteController/getDomainInfo');//获取域名、备案号、ssl信息
    Route::post('sslRenew', 'webapi/WebsiteController/sslRenew');//ssl证书续费
    Route::post('verificationDomain', 'webapi/WebsiteController/verificationDomain');//域名解析验证
    Route::post('sortChannel', 'webapi/WebsiteController/sortChannel');//栏目排序
    Route::post('editChannel', 'webapi/WebsiteController/editChannel');//编辑排序
    Route::post('getChannelInfo', 'webapi/WebsiteController/getChannelInfo');//查看栏目详情
    Route::get('getWebAddressList', 'webapi/WebsiteController/getWebAddressList');//获取网站地址列表
});

/**
 * 模板模块
 */
Route::group('template', function () {
    Route::get('getCategoryList', 'webapi/TemplateController/getCategoryList');//获取模板分类列表
    Route::get('getPaginateList', 'webapi/TemplateController/getPaginateList');//获取模板分页列表
    Route::post('immediateUse', 'webapi/TemplateController/immediateUse');//立即使用
});

/**
 * 幻灯片模块
 */
Route::group('slide', function () {
    Route::get('getList', 'webapi/SlideController/getList');//获取幻灯片列表
    Route::get('getInfo', 'webapi/SlideController/getInfo');//获取幻灯片详情
    Route::post('edit', 'webapi/SlideController/edit');//添加、编辑幻灯片
    Route::post('delete', 'webapi/SlideController/delete');//删除幻灯片
    Route::post('sort', 'webapi/SlideController/sort');//幻灯片排序
});

/**
 * 分类模块
 */
Route::group('category', function () {
    Route::get('getTreeList', 'webapi/CategoryController/getTreeList');//获取分类列表(包含子集的树形列表)
    Route::post('edit', 'webapi/CategoryController/edit');//编辑分类信息
    Route::post('delete', 'webapi/CategoryController/delete');//删除分类
    Route::post('sort', 'webapi/CategoryController/sort');//分类排序
});

/**
 * 文章模块
 */
Route::group('article', function () {
    Route::get('getPaginateList', 'webapi/cms.ArticleController/getPaginateList');//获取文章分页列表
    Route::get('getInfo', 'webapi/cms.ArticleController/getInfo');//获取文章详情
    Route::post('edit', 'webapi/cms.ArticleController/edit');//添加、编辑文章
    Route::post('delete', 'webapi/cms.ArticleController/delete');//删除文章
});

/**
 * 产品模块
 */
Route::group('product', function () {
    Route::get('getPaginateList', 'webapi/cms.ProductController/getPaginateList');//获取产品分页列表
    Route::get('getInfo', 'webapi/cms.ProductController/getInfo');//获取产品详情
    Route::post('edit', 'webapi/cms.ProductController/edit');//添加、编辑产品
    Route::post('delete', 'webapi/cms.ProductController/delete');//删除产品
});

/**
 * 案例模块
 */
Route::group('case', function () {
    Route::get('getPaginateList', 'webapi/cms.CaseController/getPaginateList');//获取案例分页列表
    Route::get('getInfo', 'webapi/cms.CaseController/getInfo');//获取案例详情
    Route::post('edit', 'webapi/cms.CaseController/edit');//添加、编辑案例
    Route::post('delete', 'webapi/cms.CaseController/delete');//删除案例
});

/**
 * 单页模块
 */
Route::group('single', function () {
    Route::get('getCompanyIntroduction', 'webapi/cms.SingleController/getCompanyIntroduction');//获取公司简介详情
    Route::get('getIndustryConsulting', 'webapi/cms.SingleController/getIndustryConsulting');//获取行业咨询详情
    Route::get('getHonoraryQualifications', 'webapi/cms.SingleController/getHonoraryQualifications');//获取荣誉资质详情
    Route::get('getContactUs', 'webapi/cms.SingleController/getContactUs');//获取联系我们详情
    Route::post('settCompanyIntroduction', 'webapi/cms.SingleController/settCompanyIntroduction');//设置公司简介
    Route::post('setIndustryConsulting', 'webapi/cms.SingleController/setIndustryConsulting');//设置行业咨询
    Route::post('setHonoraryQualifications', 'webapi/cms.SingleController/setHonoraryQualifications');//设置荣誉资质
    Route::post('setContactUs', 'webapi/cms.SingleController/setContactUs');//设置联系我们
});

/**
 * 链接模块
 */
Route::group('link', function () {
    Route::get('getPaginateList', 'webapi/LinkController/getPaginateList');//获取链接分页列表
    Route::get('getInfo', 'webapi/LinkController/getInfo');//获取链接详情
    Route::post('edit', 'webapi/LinkController/edit');//添加、编辑链接
    Route::post('delete', 'webapi/LinkController/delete');//删除链接
});

/**
 * 统计模块
 */
Route::group('statistics', function () {
    Route::get('getTodayVisitStatisticsDate', 'webapi/StatisticsController/getTodayVisitStatisticsDate');//获取今日访问统计数据
    Route::get('getHistoryVisitListByMouth', 'webapi/StatisticsController/getHistoryVisitListByMouth');//获取历史访问数据(按月份分组)
    Route::get('getHealthExaminationList', 'webapi/StatisticsController/getHealthExaminationList');//获取健康检查数据列表
});

/**
 * 辅助模块
 */
Route::group('auxiliary', function () {
    Route::post('uploadImages', 'webapi/AuxiliaryController/uploadImages');//图片上传
    Route::get('getDistributionMediaList', 'webapi/AuxiliaryController/getDistributionMediaList');//获取媒体平台信息列表
});

//当路由规则都不匹配的话，会路由到`miss`
Route::miss(function () {
    return show(10000);
});